package com.server.protocol;

import java.nio.ByteBuffer;

import org.apache.log4j.Logger;

import com.nio.io.Request;
import com.nio.io.Response;
import com.nio.protocol.Protocol;

public class LoginReq extends Protocol {

  private Logger log=Logger.getLogger(this.getClass());

  private static final short PTL_ID=0x0001;

  private String content;

  @Override
  public void decode(Request req) {
    ByteBuffer myBuf=req.getBodyData();
    content=new String(myBuf.array());
    log.debug("decode data=" + content);
  }

  @Override
  public void encode(Response resp) {
    // TODO Auto-generated method stub
  }

  @Override
  public Protocol execute() {
    log.debug("execute");
    return new LoginResp(1);
  }

  @Override
  public short getProtocolId() {
    return PTL_ID;
  }
}
